package mtmmtest.kchao.com.mtmmtest;

import android.app.Application;
import android.os.Environment;
import android.util.Log;

import com.alipay.euler.andfix.patch.PatchManager;

import java.io.File;
import java.io.IOException;

/**
 * Created by liyanchao on 2016/9/28.
 */
public class TestApplication extends Application {
    public PatchManager mPatchManager;

    @Override
    public void onCreate() {
        super.onCreate();
        // 初始化patch管理类
        mPatchManager = new PatchManager(this);
        // 初始化patch版本
        mPatchManager.init("1.0");
        // 加载已经添加到PatchManager中的patch
        mPatchManager.loadPatch();
        String patch= Environment.getExternalStorageDirectory().getAbsolutePath()+"//out.apatch";
        File f=new File(patch);
        if(f.exists()){
            Log.v("kchao","cunzai");
            try {
                mPatchManager.addPatch(patch);
            } catch (IOException e) {
                e.printStackTrace();
            }
            f.delete();
        }else{
            Log.v("kchao","bucunzai");
        }
    }
}
